package appconfig

import (
	"fmt"
	"github.com/spf13/viper"
)

type NacosConfig struct {
	NacosName string
	User      string
	Password  string
	Host      string
	Port      int
	DataID    string
	Group     string
}

type MySQLConfig struct {
	User     string
	Password string
	Host     string
	Port     int
	Db       string
}

type RedisConfig struct {
	Password string
	Host     string
	Port     int
}
type DataConfig struct {
	NacosConfig
	MySQLConfig
	RedisConfig
}

var Conf DataConfig

//week-tow/grpc/internal

func Appconfig() {
	viper.SetConfigFile("./internal/appconfig/conf.yaml")

	err := viper.ReadInConfig()
	if err != nil {

		fmt.Println("viper配置失败")
		panic(err)
		return
	}
	fmt.Println("viper配置成功")

	viper.Unmarshal(&Conf)
}
